<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - DatePickerField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body class="yui-skin-sam">

<h1>inputEx - DatePickerField Usage</h1>


<!-- Example 1 -->
<div class='exampleDiv'>
	<h2>Basic DatePickerField creation</h2>
	<p>Use the following code to create a basic inputEx DatePickerField.</p>
	<div class='demoContainer' id='container1'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.DatePickerField({parentEl: 'container1'});
		</textarea>
	</div>
</div>


<!-- Example 2 -->
<div class='exampleDiv'>
	<h2>Change DatePickerField date format</h2>
	<p>Use the following code to select another date format</p>
	<div class='demoContainer' id='container2'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.DatePickerField({parentEl: 'container2', value: new Date(1984,0,6), dateFormat: 'd/m/Y'});
		</textarea>
	</div>
</div>


<!-- Example 3 -->
<div class='exampleDiv'>
	<h2>DatePickerField Updated event</h2>
	<p>Listening for the updatedEvt</p>
	<div class='demoContainer' id='container3'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var datepicker = new inputEx.DatePickerField({parentEl: 'container3', value: new Date(), dateFormat: 'd/m/Y'});
			datepicker.updatedEvt.subscribe( function(e,params) {
				var value = params[0];
				YAHOO.util.Dom.get('container3').appendChild( inputEx.cn('div',null,null, value) );
			});
		</textarea>
	</div>
</div>




<!-- Example 4 -->
<div class='exampleDiv'>
	<h2>Use a string input/output formatting</h2>
	<p>The setValue/getValue methods will parse/format the dates to the <i>valueFormat</i> option.</p>
	<div class='demoContainer' id='container4'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var datepicker2 = new inputEx.DatePickerField({parentEl: 'container4', value: new Date(), valueFormat: 'Y-m-d', value: '2009-01-01'});
			datepicker2.updatedEvt.subscribe( function(e,params) {
				var value = params[0];
				YAHOO.util.Dom.get('container4').appendChild( inputEx.cn('div',null,null, value) );
			});
		</textarea>
	</div>
</div>


<!-- Example 5 -->
<div class='exampleDiv'>
	<h2>Disable DatePicker</h2>
	<p>Disable method</p>
	<div class='demoContainer' id='container5'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var f = new inputEx.DatePickerField({parentEl: 'container5'});
			
			var exampleDiv = YAHOO.util.Dom.get('container5');
			
			var button1 = inputEx.cn('button', null, null, 'disable()');
			exampleDiv.appendChild(button1); 
			YAHOO.util.Event.addListener(button1, 'click', function() { f.disable(); });

			var button2 = inputEx.cn('button', null, null, 'enable()');
			exampleDiv.appendChild(button2); 
			YAHOO.util.Event.addListener(button2, 'click', function() { f.enable(); });
			
		</textarea>
	</div>
</div>



<!-- Example 6 -->
<div class='exampleDiv'>
	<h2>Disable readonly option</h2>
	<p>If you want to let users enter the date manually</p>
	<div class='demoContainer' id='container6'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.DatePickerField({parentEl: 'container6', readonly: false, showMsg: true});
		</textarea>
	</div>
</div>



<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="../lib/yui/calendar/calendar-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/DateField.js"  type='text/javascript'></script>
<script src="../js/fields/DatePickerField.js"  type='text/javascript'></script>

<!-- InputEx examples -->
<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>

 </body>
</html>